//api文件仍保留但不建议使用，推荐使用models中的api。API files remain preserved (deprecated), use models APIs instead.
import type { Entity, EntityResponse } from './types.js';

import { requestClient } from '#/api/request';

export const getdbNameEntityList = async (page: number, pageSize: number,
  searchParams?: any) => {
  return requestClient.get<EntityResponse>(`/dbName/tableName/${pageSize}/${page}`,{
    params: searchParams,
  });
};

export const getdbNameEntity = async (id: string) => {
  return requestClient.get<Entity>(`/dbName/tableName/${id}`);
};

export const adddbNameEntity = async (data: Partial<Entity>) => {
  return requestClient.post<Entity>('/dbName/tableName/add', data);
};

export const editdbNameEntity = async (data: Partial<Entity>) => {
  return requestClient.post<Entity>('/dbName/tableName/edit', data);
};

export const deletedbNameEntity = async (id: string) => {
  return requestClient.post<any>('/dbName/tableName/del', { id });
};
